package top.hencter.weibo.adapter;

import android.content.Context;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ArrayAdapter;
import android.widget.ImageView;

import androidx.annotation.NonNull;
import androidx.annotation.Nullable;

import com.bumptech.glide.Glide;

import java.util.ArrayList;
import java.util.List;

import top.hencter.weibo.R;

public class FindGridViewAdapter extends ArrayAdapter<String> {


    public FindGridViewAdapter(@NonNull Context context, int resource, @NonNull List<String> objects) {
        super(context, resource, objects);
    }

    @NonNull
    @Override
    public View getView(int position, @Nullable View convertView, @NonNull ViewGroup parent) {

        View view = LayoutInflater.from(getContext()).inflate(R.layout.find_gridview_item, parent, false);
        final String url = getItem(position);
        ImageView imageView = view.findViewById(R.id.find_image_grid_view);
        Glide.with(getContext()).load(url).into(imageView);
        return view;
    }
}
